package com.antkit.mark.ak

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.FrameLayout
import android.widget.Toast
import io.flutter.facade.Flutter
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.MethodChannel

class MainActivity : AppCompatActivity() {

    companion object {
        val PUSH_CHANNEL = "sample.flutter.io/push"
        val PULL_CHANNEL = "sample.flutter.io/pull"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)



       /* val flutter = Flutter.createView(this,lifecycle,"app/home")
        addContentView(flutter,FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT))

        EventChannel(flutter, PUSH_CHANNEL)
            .setStreamHandler(object :EventChannel.StreamHandler{
                override fun onListen(p0: Any?, p1: EventChannel.EventSink?) {
                    p1?.success(getName())
                }

                override fun onCancel(p0: Any?) {

                }

            })
        MethodChannel(flutter, PULL_CHANNEL).setMethodCallHandler{methodCall,

        result -> run{
            if (methodCall.method.equals("refresh")) {
                refresh()
                result.success("")
            } else {
                result.success("succeed")
               // result.notImplemented()
            }
        }}*/

//测试master
//测试mark
//测试master
    }
    fun getName(): String? = "flutter_module"
    fun refresh() {
        //showShort("refresh")
        Toast.makeText(this,"refresh",Toast.LENGTH_SHORT);
    }
}
